<?php
/* include files needed to connect to database */
include 'system/libraries/database.php';
  session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <title>AllPrices-Products-Stats</title> 
    <link rel="stylesheet" type="text/css" href="css/style.css" />
    <link rel="stylesheet" type="text/css" href="css/top-menu.css" /> 
    
    <link rel="stylesheet" type="text/css" href="css/styleMultiselect.css" />
    <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/redmond/jquery-ui.css" />

    <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
    <script type="text/javascript" src="js/jquery.multiselect.js"></script>
    
    <script type="text/javascript" src="js/registerUser.js"></script>
    <script type="text/javascript" src="js/stats/common.js"></script>
    <script type="text/javascript" src="js/stats/statsProducts.js"></script>
    <script type="text/javascript" src="js/flot/jquery.flot-with-plugins.js"></script>
    <script type="text/javascript">
      $(document).ready(function() {
        InitFiltersForm();
      });
    </script>
  </head>

  <body>
 
    <div id="header" style="height: 75px;" class="block">
      <div id="logo" class="block">
        <a href="/"><img style="margin-bottom: 10px;" src="img/logo-beta.png" alt="AllPrices.md" /></a>
      </div>
    </div>  
    
    <div id="content">
      
      <div class ="top_menu" id="menu">
        <ul class="blue">
          <li><a class="first" title="home" href="index.php"><span>Overview</span></a></li>
          <li><a title="Categories" href="categories.php"><span>Categories</span></a></li>
          <li><a class="current" title="products" href="products.php"><span>Products</span></a></li>
        </ul>
        <div id="login">
          <?php 
            if(isset($_SESSION['name']))
              print '<span>Bun venit, <strong>' . $_SESSION['name'] . '</strong></span>';
            else
              print '<a id="sign-in-user" class="fancybox fancybox.ajax" href="iframe.php">Sign In</a>';
          ?>
          
          <?php
            if(isset($_SESSION['name']))
              print '<a id="sign-up-user" onclick="UserLogOut(); return false;" href="#"><strong>[Logout]</strong></a>';
            else
              print '<a id="sign-up-user" class="fancybox fancybox.ajax" href="iframe.php"> / Sign Up</a>';
          ?>
        </div>
      </div>
      
      <div class="clear"></div>
      
      <form id="main-form" action="#" method="GET" onsubmit="CheckResponseStatus(); return false;">
        <div class="inline-block dt-wrap">

          <span id="searchbar-input-container" class="inline-block">   
            <label for="datefrom">Date from:</label>
            <input id="datefrom" type="text" name="datefrom" onblur="$(this).parent().removeClass('focus');" onfocus="$(this).parent().addClass('focus');" autocomplete="off" name="search">
          </span>
          
          <span id="searchbar-input-container" class="inline-block">
            <label for="dateto">Date to:</label>
            <input id="dateto" type="text" name="dateto" onblur="$(this).parent().removeClass('focus');" onfocus="$(this).parent().addClass('focus');" autocomplete="off" name="search">
          </span>

          <div id="options" >
            <select id="timeunit" onchange = "CheckResponseStatus(); return false;"> 
              <option value="day">day</option>
              <option value="week">week</option>
              <option value="month">month</option>
            </select>
                   
            <script type="text/javascript">
              $("select").multiselect(
              {
                multiple: false,
                header: "Select an option",
                noneSelectedText: "Select an Option",
                selectedList: 1
              });
            </script>
          </div>

          <div id="category_select_id"></div>
          <input class="button medium green" type="submit" value="Go" onclick="CheckResponseStatus(); return false;"/>
        </div>
        
        <div id="buttons">
          <input class="button medium green" type="submit" value ="<< week" onclick="DatePeriod('prevWeek'); return false;" />
          <input class="button medium green" type="submit" value ="week >>" onclick="DatePeriod('nextWeek'); return false;"/>
          <input class="button medium green" type="submit" value ="<< month" onclick="DatePeriod('prevMonth'); return false;"/>
          <input class="button medium green" type="submit" value ="month >>" onclick="DatePeriod('nextMonth'); return false;"/>
        </div>
        
      </form>

      <h3>Top 4 Products  by views</h3>
      <div id="product-price-history-flot"></div>
      <div id="choices"></div>
      <h3>Top 10 Products  by views</h3>
      <div id="Data_table"> </div>
    </div>
    
  </body> 
</html>

